package day9;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

/**
 * @author oldliu
 * @since 1.0
 */
public class FileReaderTest {
    public static void main(String[] args) {
        try {
            Reader reader=new FileReader("D:\\Documents\\桌面\\78-introduction.txt");
       //     int ch=0;
            //全部
//            while ((ch=reader.read())!=-1){
//                System.out.println(ch+","+(char)ch);//没有汉字读一半的情况
//            }
            char []c=new char[20];
            int len=0;
            while ((len=reader.read(c))!=-1){
                System.out.println(new String(c,0,len));
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
